package com.icim.util;

import java.io.File;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class Dom4jUtil {

    public static String getTrxId(File file) throws DocumentException {
        SAXReader reader = new SAXReader();
        Document doc = reader.read(file);
        Element rootElement = doc.getRootElement();
        Element trxElement = rootElement.element("trx_name");
        trxElement = trxElement != null ? trxElement : rootElement.element("TRX_NAME");
        return trxElement.getText();
    }
    
}
